//
//  SecondLeftTableViewCell.m
//  项目A --半糖
//
//  Created by romana on 16/5/21.
//  Copyright © 2016年 romana. All rights reserved.
//

#import "SecondLeftTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "SecondTabLeftThirdModel.h"
@implementation SecondLeftTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
     
        [self doIt];
    }
    return self;


}

-(void)doIt{
    
    self.TitleLabel = [[UILabel alloc] init];
    self.TitleLabel.backgroundColor = [UIColor clearColor];
    self.TitleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.TitleLabel];
    
    self.circleImageV = [[UIImageView alloc] init];
    self.circleImageV.backgroundColor = [UIColor clearColor];
    self.circleImageV.layer.masksToBounds = YES;
    self.circleImageV.layer.cornerRadius = 15;
    [self.contentView addSubview:self.circleImageV];
    
    self.nameLabel = [[UILabel alloc] init];
    self.nameLabel.backgroundColor = [UIColor clearColor];
    self.nameLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.nameLabel];
    
    self.timeLabel = [[UILabel alloc] init];
    self.timeLabel.backgroundColor = [UIColor clearColor];
    self.timeLabel.font = [UIFont systemFontOfSize:14];

    [self.contentView addSubview:self.timeLabel];
    
    self.picImageV1 = [[UIImageView alloc] init];
    self.picImageV1.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.picImageV1];
    
    self.picImageV2 = [[UIImageView alloc] init];
    self.picImageV2.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.picImageV2];
    
    self.picImageV3 = [[UIImageView alloc] init];
    self.picImageV3.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.picImageV3];
    
    self.numPicImageV1 = [[UIImageView alloc] init];
    self.numPicImageV1.backgroundColor = [UIColor clearColor];
    self.numPicImageV1.image = [UIImage imageNamed:@"eyes"];
    [self.contentView addSubview:self.numPicImageV1];
    
    self.numPicImageV2 = [[UIImageView alloc] init];
    self.numPicImageV2.backgroundColor = [UIColor clearColor];
    self.numPicImageV2.image = [UIImage imageNamed:@"comment"];
    [self.contentView addSubview:self.numPicImageV2];
    
    
    self.numLabel1 = [[UILabel alloc] init];
    self.numLabel1.textAlignment = NSTextAlignmentCenter;
    self.numLabel1.backgroundColor = [UIColor clearColor];
    self.numLabel1.font = [UIFont systemFontOfSize:14];

    [self.contentView addSubview:self.numLabel1];

    
    self.numLabel2 = [[UILabel alloc] init];
    self.numLabel2.backgroundColor = [UIColor clearColor];
    self.numLabel2.font = [UIFont systemFontOfSize:14];

    [self.contentView addSubview:self.numLabel2];
    
    self.myView = [[UIView alloc] init];
    self.myView.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:0.8];
    [self.contentView addSubview:self.myView];
    
    


}




-(void)layoutSubviews
{

    self.TitleLabel.frame = CGRectMake(0, 0, self.frame.size.width, 50);
    self.circleImageV.frame = CGRectMake(self.frame.size.width / 3 - 40, 60, 30, 30);
    self.nameLabel.frame = CGRectMake(self.frame.size.width / 3 - 5, 50, 100, 50);
    self.timeLabel.frame = CGRectMake(self.frame.size.width / 2 + 30, 50, 100, 50);
    
    self.picImageV1.frame = CGRectMake(10, 100, (self.frame.size.width - 40) / 3, 125);
    self.picImageV2.frame = CGRectMake((self.frame.size.width - 40) / 3 + 20, 100, (self.frame.size.width - 40) / 3, 125);
    self.picImageV3.frame = CGRectMake((self.frame.size.width - 40) / 3 * 2 + 30, 100, (self.frame.size.width - 40) / 3, 125);
    
    self.numPicImageV1.frame = CGRectMake(self.frame.size.width / 2 - 70, 235, 20, 20);
    self.numLabel1.frame = CGRectMake(self.frame.size.width / 2 - 50, 235, 50, 20);
    self.numPicImageV2.frame = CGRectMake(self.frame.size.width / 2, 235, 20, 20);
    self.numLabel2.frame = CGRectMake(self.numPicImageV2.frame.origin.x + 25, 235, 50, 20);
    
    self.myView.frame = CGRectMake(0, 265, self.frame.size.width, 10);




}


-(void)setSTLSModel:(SecondTabListSecondModel *)STLSModel{

    _STLSModel = STLSModel;
    
    self.ImageArray = [NSMutableArray array];
    self.ImageArray = [NSMutableArray arrayWithArray:_STLSModel.pics];
    SecondTabLeftThirdModel *model1 = _STLSModel.pics[0];
    [self.picImageV1 sd_setImageWithURL:[NSURL URLWithString:model1.url]];

    SecondTabLeftThirdModel *model2 = _STLSModel.pics[1];
    [self.picImageV2 sd_setImageWithURL:[NSURL URLWithString:model2.url]];
    
    SecondTabLeftThirdModel *model3 = _STLSModel.pics[2];
    [self.picImageV3 sd_setImageWithURL:[NSURL URLWithString:model3.url]];
    
    self.TitleLabel.text = _STLSModel.title;
    self.numLabel1.text = _STLSModel.views;
    self.numLabel2.text = _STLSModel.likes;
    
    [self.circleImageV sd_setImageWithURL:[NSURL URLWithString:_STLSModel.avatar]];
    self.nameLabel.text = _STLSModel.nickname;
    self.timeLabel.text = _STLSModel.create_time_str;
    


}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
